window.onload = function(){
//	top_right start
//	点击按钮实现下拉菜单
	var index = 0;

//	banner start
	var timer = null;
	var sliders = document.getElementById("sliders");
	var slider = document.getElementById("slider");
	var circle = document.getElementById("circle");
	var cirLis = circle.children;
	var lis = sliders.children;
//	自动轮播
	timer = setInterval(function(){
		index++;
		index > lis.length - 1 ? index = 0 : index;
		for(var i = 0; i < lis.length; i++) {
			lis[i].className = "";
			lis[index].className = "d-b";
			cirLis[i].className = "";
			cirLis[index].className = "main-color";
		}
	},3000);
	
//	鼠标出入
	slider.onmouseover = function() {
		clearInterval(timer);
	}
	slider.onmouseout = function() {
		timer = setInterval(function(){
			index++;
			index > lis.length - 1 ? index = 0 : index;
			for(var i = 0; i < lis.length; i++) {
				lis[i].className = "";
				lis[index].className = "d-b";
				cirLis[i].className = "";
				cirLis[index].className = "main-color";
			}
		},3000);
		
	}

//	小圆点控制轮播
	for(var i = 0; i < cirLis.length; i++) {
		cirLis[i].index = i;
		cirLis[i].onclick = function() {
			index = this.index;
			for(var j = 0; j < cirLis.length; j++) {
				cirLis[j].className = "";
				lis[j].className = "";
			}
			lis[index].className = "d-b";
			cirLis[index].className = "main-color";
		}
	}
//	banner end



	function tab(list, obj) {
		var obj = document.getElementById(obj);
		var list = document.getElementById(list);
		var obj_child = obj.children;
		var list_child  = list.children;
		for(var i = 0; i < list_child.length; i++) {
			list_child[i].index = i;
			list_child[i].onmouseover = function() {
				for(var j = 0; j < obj_child.length; j++) {
					obj_child[j].className = "d-n";
					list_child[j].className = "";
				}
				obj_child[this.index].className = "d-b";
				list_child[this.index].className = "on";
			}
		}
	}
	tab("tab_1","list-main");
	tab("tab_2","list_2");
	top_slider();
	
	
}